
#ifndef QV_GENALG_H
#define QV_GENALG_H

#include "qv_local.h"

/* GA constants */
#define QV_SWAPPOINT_RATE		0.08
#define QV_CROSSOVER_RATE		0.90
#define QV_MUTATION_MU			0.05
#define QV_MUTATION_SIGMA		0.05
#define QV_DEPENDENCIES			1

#define QV_ROULETTE_SELECTION	0
#define QV_ELITE_SELECTION		1

/* Function declarations */
void qv_runGeneticAlgorithm(gclient_t *clients);

void getBotData(gclient_t *clients, int roundNum);

int calcBotFitnessVal(int index, int fitnessFunc);
float *getBotFitnessVals(void);
void shiftFitnessVals(float *fitnessBuffer);
void normalizeFitnessVals(float *fitnessBuffer);

int *selectParentBotsRoulette(float *fitnessArray);
int *selectParentBotsElite(float *fitnessArray);
void interbreedBots(int *parents, int botIndex, int roundNum, QV_genData *oldGenData, QV_genData *newGenData);
void interBreedCharacts(int crossoverBool, int botIndex, int *parents, QV_genData *oldGens, QV_genData *newGens);
void interBreedWeights(int crossoverBool, int botIndex, int *parents, QV_genData *oldGens, QV_genData *newGens);

int isMutateBotCharact(int botCharNum);

int getMappingCharact(int botCharNum);
char **normalizeBasicGens(QV_genData *genData, int botNum);
char **normalizeItemWeightGens(QV_genData *genData, int botNum);


#endif
